import * as webpack from 'webpack';
import * as CompressionWebpackPlugin from 'compression-webpack-plugin';
import * as merge from 'webpack-merge';
import * as HtmlWebpackPlugin from 'html-webpack-plugin';
import * as path from 'path';
import BaseConfig from '../webpack.config';

const config = merge(BaseConfig, {
    mode: 'production',
    plugins: [
        new webpack.DefinePlugin({
			"process.env":{
				NODE_ENV:JSON.stringify('production')
			}
		}),
		new CompressionWebpackPlugin({
			asset: '[path].gz[query]',
			algorithm: 'gzip',
			test: /\.(js|css)/,
			threshold: 1024,
			minRatio: 0.8
		}),
		new HtmlWebpackPlugin({
			template: path.join(__dirname,'../public/index.html'),
			filename: "index.html",
			favicon: path.join(__dirname,'../src/assets/favicon.ico'),
			hash: true,
			path: "http://45.40.244.50/qrcode/"
		})
    ]
})

export default config;